//
//  DetailSpecialSubModel.m
//  BTRIP
//
//  Created by johnbk on 15/11/16.
//  Copyright © 2015年 johnbk. All rights reserved.
//

#import "DetailSpecialSubModel.h"

@implementation DetailSpecialSubModel
-(void)dealloc{
	[_note_id release];
	[_desp release];
	[_image_url release];
	[_attraction_id release];
	[_attraction_name release];
	[_title release];
	[_image_height release];
	[_image_width release];
	[_arrayOfBlogger release];
	[super dealloc];
}
- (void)setValue:(id)value forKey:(NSString *)key{
	self.isAttraction_name = NO;
	if ([key isEqualToString:@"description"]) {
		self.desp = value;
	}else if([key isEqualToString:@"attraction"]){
		self.attraction_id = value[@"id"];
		self.attraction_name = value[@"name"];
		self.isAttraction_name = YES;
		//NSLog(@"🍎%@", value[@"name"]);
	}
	else if ([key isEqualToString:@"note"]){
		self.note_id = value[@"id"];
	}else if ([key isEqualToString:@"description_user_ids"]){
		NSArray *arr = [value allKeys];
		NSMutableArray *array = [NSMutableArray array];
		for (NSString *str in arr) {
			Blogger *blogger = [[Blogger alloc]init];
			blogger.number = str;
			blogger.name = value[blogger.number];
			[array addObject:blogger];
			[blogger release];
		}
		self.arrayOfBlogger = array;
	}
	else{
		[super setValue:value forKey:key];
	}
}
@end
